use core::fmt;
use std::fmt::Debug;



#[derive(Debug, PartialEq)]
pub struct TokenComposite {
    pub token: Token,
    pub attri: TokenAttri,
}

#[non_exhaustive]
#[derive(Debug, PartialEq)] 
pub enum Token {
    // 
    Ident(String),
    Integer(i64),
    Float(f64),
    // keyword
    Keyword(Keyword),
    Operator(Operator),
    Delimit(Delimit),
    EOI,
}

#[non_exhaustive]
#[derive(Debug, PartialEq)] 
pub enum Keyword {
    CONST,
    INT,
    FLOAT,
    VOID,
    IF,
    ELSE,
    WHILE,
    BREAK,
    CONTINUE,
    RETURN,
}

#[non_exhaustive]
#[derive(Debug, PartialEq)] 
pub enum Operator {
    PLUS,
    MINUS,
    MUL,
    DIV,
    MOD,
    ASSIGN,
    EQ,
    NEQ,
    LT,
    GT,
    LE,
    GE,
    NOT,
    AND,
    OR,
}

#[non_exhaustive]
#[derive(Debug, PartialEq)] 
pub enum Delimit {
    L_PAREN,
    R_PAREN,
    L_BRACE,
    R_BRACE,
    L_BRACKT,
    R_BRACKT,
    COMMA,
    SEMICOLON,
}

// 
#[derive(Debug, PartialEq)]
pub struct TokenAttri {
    pub position: Position,
    pub len: usize,
}

#[derive(Debug, PartialEq)]
pub struct Position {
    pub line: usize,
    pub column: usize,
}

// impl
fn build_fmt(f: &mut std::fmt::Formatter<'_>, ty: &str, v: &str) -> std::fmt::Result {
    write!(f, "{} {}", ty, v)
}

impl Token {

}

impl Keyword {
    
}

impl Operator {
    
}

impl Delimit {
    
}